import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { visitorAuditForm, visitorAuditVO } from '@/api/access/visitor/visitor-audit/types';

/**
 * 查询访客审批列表
 * @param query
 * @returns {*}
 */

export const listvisitorAudit = (query): AxiosPromise<visitorAuditVO[]> => {
  return request({
    url: '/visitor/visitor-audit/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询访客审批详细
 * @param visitorAuditId
 */
export const getvisitorAudit = (visitorAuditId: string | number): AxiosPromise => {
  return request({
    url: '/visitor/visitor-audit/' + visitorAuditId,
    method: 'get'
  });
};

/**
 * 新增访客审批
 * @param data
 */
export const addvisitorAudit = (data) => {
  return request({
    url: '/visitor/visitor-audit',
    method: 'post',
    data: data
  });
};

/**
 * 修改访客审批
 * @param data
 */
export const updatevisitorAudit = (data: visitorAuditForm) => {
  return request({
    url: '/visitor/visitor-audit',
    method: 'put',
    data: data
  });
};

/**
 * 删除访客审批
 * @param visitorAuditId
 */
export const delvisitorAudit = (visitorAuditId: string | number | Array<string | number>) => {
  return request({
    url: '/visitor/visitor-audit/' + visitorAuditId,
    method: 'delete'
  });
};
